package com.o2o.enums;

/**
 * package_name:com.o2o.enums
 * Author:徐亚远
 * Date:2019/12/10 17:40
 * 项目名:o2o
 * Desription:
 **/
public enum  ProductCategoryStateEnum {
    SUCCESS(1,"创建成功"),INNER_ERROR(-1001,"操作失败"),

    EMPTY_LIST(-1002,"添加数少于1");

    private int state;

    private String stateInfo;

    private ProductCategoryStateEnum(int state, String stateInfo) {
        this.state = state;
        this.stateInfo = stateInfo;
    }

    public int getState() {
        return state;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    public static ProductCategoryStateEnum stateOf(int index) {
        for (ProductCategoryStateEnum state : values()) {
            if (state.getState() == index) {
                return state;
            }
        }
        return null;
    }
}
